import Vue from "vue";
import Vuex from "vuex";
Vue.use(Vuex);
const modulesFn = require.context("./module", true, /\.js$/);
const regex = /.*\/(.*)\.js$/;
const modules = {};
modulesFn.keys().forEach((filepath) => {
  let moduleName = regex.exec(filepath);
  if (moduleName !== null) {
    moduleName = moduleName[1];
  }
  const moduleObj = modulesFn(filepath);
  modules[moduleName] = {
    ...moduleObj.default,
  };
});
export default modules;
